package com.lxyk.service.student.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lxyk.dao.student.QuitDao;

import com.lxyk.domain.StudentVO2;
import com.lxyk.domain.StudentVO3;
import com.lxyk.service.student.QuitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class QuitServiceImpl implements QuitService {

    @Autowired
    private QuitDao quitDao;

    @Override
    public void addQuit(StudentVO3 student) {
        quitDao.addQuit(student);
    }

    @Override
    public void updateQuit(StudentVO3 student) {
        quitDao.updateQuit(student);
    }

    @Override
    public PageInfo<StudentVO3> quitByCid(Integer cid, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<StudentVO3> list = quitDao.quitByCid(cid);
        return new PageInfo<>(list);
    }

    @Override
    public PageInfo<StudentVO3> findQuitByCondition(StudentVO3 vo, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<StudentVO3> list = quitDao.findQuitByCondition(vo);
        return new PageInfo<>(list);
    }

    @Override
    public StudentVO3 findQuitById(Integer id) {
        return quitDao.findQuitById(id);
    }

    @Override
    public int findCountByCid(Integer cid) {
        return quitDao.findCountByCid(cid);
    }

    @Override
    public void updateStudent(StudentVO3 student) {
        quitDao.updateStudent(student);
    }
}
